import java.util.*;


public class Test3 {
    public static void main(String[] args) {
        String[] board = new String[]{"XYZE","SFZS","XDEE"};
        String word = null;

        System.out.println(exist(board, word));
    }
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     *
     * @param board string字符串一维数组 
     * @param word string字符串 
     * @return bool布尔型
     */
    public static boolean exist (String[] board, String word) {
        // write code here
        for (int i = 0; i < word.length(); i++) {
            boolean flag = false;//对应字符有没有找到
            char ch1 = word.charAt(i);//要找的字符
            for (int j = 0; j < board.length; j++) {
                String str = board[j];
                for (int k = 0; k < board[j].length(); k++) {
                    if (ch1 == str.charAt(k)) {
                        flag = true;
                        // 去掉匹配到的字符
                        if (k == 0) {
                            board[j] = str.substring(1);
                        } else if (k == str.length() - 1){
                            board[j] = str.substring(0, k);
                        } else {
                            board[j] = str.substring(0, k) + str.substring(k + 1);
                        }
                        // str = str.substring(0, k - 1) + str.substring(k + 1, str.length() - 1);
                        break;
                    }
                }
                if (flag) {
                    break;
                }
            }
            if (!flag) {
                return flag;
            }

        }

        return true;
    }
}